// 定义工厂类
class Factory {
  create(type) {
    if (type === 'A') {
      return new createA()
    } else if (type === 'B') {
      return new createB()
    }
  }
}

const factory = new Factory();
const factoryA = factory.create('A');
const factoryB = factory.create('B');
